<%@ include file = "/common/ini.jsp"%> 
<%@ include file = "/common/_ApplicationContext_init.jsp"%> 
<%@ include file = "/common/_vr.jsp"%> 
<%@ include file = "/js/_js_for_select.jsp"%> 
<%@ include file = "/js/_of_js.jsp"%> 
<%
    // 定义名称
    String title = "请选定题型";
    String remark = "";
    TypeManager typeManager = (TypeManager)applicationContext.getBean("typeManager");	
%>
<script>
    function validate()
    {
        initValidate();
        $('subjectInQuestTypeSpan').innerHTML = "";
        $('questTypeSpan').innerHTML = "";
        $('nextstep').disabled = true;
        if($('subjectInQuestTypeId').value == null)
        {
            $('subjectInQuestTypeSpan').innerHTML = "<font color='red'>尚未初始化，请联系管理员</font>";
            inValidated();
        }
        if($('questTypeId').value == null || $('questTypeId').value == "")
        {
            $('questTypeSpan').innerHTML = "<font color='red'>必填</font>";
            inValidated();
        }
        $('nextstep').disabled = !isAllValidated();

    }

    function goback()
    {
        window.location.href = "<%= request.getContextPath()%>/moduleinfor/back2LastList.jsp";
    }

    function bodyLoadJS()
    {
        // 被聚焦的控件
        detailForm.subjectInQuestTypeId.focus(); 
    }

    function reset()
    {
        <%        
        // 题型
        Object[] qts = typeManager.getByCode("questionType").getSubTypes().toArray();
        for(int i = 0; i < qts.length; i ++)
        {
            Type qt = (Type)qts[i];
            %>addOption(detailForm.subjectInQuestTypeId,"<%= qt.getId()%>","<%= qt.getName()%>");<%
        }
        %>
    }

    function submitData(bo)
    {
        bo.disabled = true;
        detailForm.submit();
    }
</script>
<%@ include file = "/common/detail/_OnForm.jsp"%> 
<form name="detailForm" method="get" action="redirectByQuestType.jsp">
        <tr>
            <td class="detailTD11">学科&nbsp;&nbsp;</td>
            <td class="detailTD12">
                <select id="subjectInQuestTypeId" name="subjectInQuestTypeId" onkeyup="nextOfFocused(this)" afterFocusedJS="" of="true">					
				</select>&nbsp;&nbsp;
                <span id="subjectInQuestTypeSpan"></span>
            </td>
            <script type="text/javascript">
                new Form.Element.Observer('subjectInQuestTypeId', 1, 
                        function(element, value) 
                        {  
                            new Ajax.Updater('subjectInQuestTypeSpan', 
                                '<%= request.getContextPath()%>/moduleinfor/basedata/type/ajax/findBySuperTypeId.jsp?selectPlease=true', 
                                {asynchronous:true, evalScripts:true, parameters:'objId=questTypeId&value='+value});
                         })
            </script>
            <td class="detailTD11">题型&nbsp;&nbsp;</td>
            <td class="detailTD12">
                <select id="questTypeId" name="questTypeId"  onkeyup="nextOfFocused(this)" afterFocusedJS="" of="true">					
				</select>&nbsp;&nbsp;<span id="questTypeSpan"></span>
            </td>
        </tr>
</form>
<script>
        new Form.Observer('detailForm',
                          1,
                          function (element,value)
                          {
                              validate();
                          });
    </script>
<%@ include file = "/common/detail/_UnderFom_OnButton.jsp"%>
          <input id="nextstep" name="nextstep" type="button" value="下一步" disabled afterFocused="" of="true" onclick="submitData(this)">
          &nbsp;&nbsp;<input  type="button" onclick="window.location.reload()" value="重置">
          &nbsp;&nbsp;<input  type="button" onclick="goback()" value="返回">
<%@ include file = "/common/detail/_UnderFom_underButton.jsp"%>
